LIBRARY_PATH := inc/
SQL_LIB      := sqlite3_ku/include
SQL_PATH     := sqlite3_ku/lib

CC = gcc

./PHONY: all socket_client_lib
all: socket_client_lib
	$(CC) src/client.c -o bin/client -I$(LIBRARY_PATH) -I$(SQL_LIB) -Lsrc/  -L$(SQL_PATH) -lsqlite3 -lsocket_pack -llogger -ldatabase -lds18b20_project
	@make clean_so
socket_client_lib:
	$(CC) -shared -fPIC -o src/liblogger.so src/logger.c -I$(LIBRARY_PATH)
	$(CC) -shared -fPIC -o src/libdatabase.so src/database.c -I$(LIBRARY_PATH) -I$(SQL_LIB) -Lsrc/ -L$(SQL_PATH) -llogger -lsqlite3
	$(CC) -shared -fPIC -o src/libsocket_pack.so src/socket_pack.c -I$(LIBRARY_PATH)  -Lsrc/ -llogger
	$(CC) -shared -fPIC -o src/libds18b20_project.so src/ds18b20_project.c -I$(LIBRARY_PATH)

clean_so:
	@rm -f src/*.so

clean:
	@rm -f src/client

